package com.alameda.controller.v1.history;

import com.alameda.common.result.Result;
import com.alameda.history.dto.ApVideoHistoryDTO;
import com.alameda.service.history.ApVideoHistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 视频播放历史记录 前端控制层
 *
 * @author Lv
 * @date 2024/10/09
 */
@Api(tags = "视频播放历史记录")
@RestController
@RequestMapping("/ap_video_history")
public class ApVideoHistoryController {

    @Autowired
    private ApVideoHistoryService apVideoHistoryService;

    /**
     * 加载视频观看记录
     *
     * @param apVideoHistoryDTO 视频播放历史记录信息
     * @return
     */
    @ApiOperation("加载视频观看记录")
    @PostMapping("/load_history")
    public Result<?> loadHistory(@RequestBody ApVideoHistoryDTO apVideoHistoryDTO) {
        return Result.success(apVideoHistoryService.loadHistory(apVideoHistoryDTO));
    }

    /**
     * 保存视频播放记录
     *
     * @param apVideoHistoryDTO 视频播放历史记录信息
     * @return
     */
    @ApiOperation("保存视频播放记录")
    @PostMapping("/save_history")
    public Result<?> saveHistory(@RequestBody ApVideoHistoryDTO apVideoHistoryDTO) {
        return Result.success(apVideoHistoryService.saveVideoHistory(apVideoHistoryDTO));
    }
}

